#!flask/bin/python
# coding=utf-8

from flask import Flask, jsonify, render_template


app = Flask(__name__)


@app.route('/ajax')
def p_ajax():
    return render_template('ajax.html') # send_file('ajax.html')


@app.route('/index')
def p_index():
    return render_template('index.html') # send_file('index.html')


@app.route('/apk/get_test', methods=['GET'])
def index_string():
    return "this is result from python server."


@app.route('/apk/post_test', methods=['POST'])
def index_post():
    return jsonify({
        'result': "hello post"
    })


@app.route('/apk/version_update', methods=['GET', 'POST'])
def index_apk():
    return jsonify({
        'versionCode': 102,
        'versionName': '2.0.1',
        'msg': "有新版本可供更新.\n 1.界面美化 \n 2.性能优化",
        'apk': 'http://192.168.10.80:9090/tmp/b.apk'
    })


if __name__ == '__main__':
    app.run(debug=True, host="0.0.0.0", port=5005)

